package cn.itcast.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum DegreeEnum {
    JUNIOR(1, "初中"),
    SENIOR(2, "高中"),
    COLLEGE(3, "大专"),
    BACHELOR(4, "本科"),
    MASTER(5, "硕士"),
    DOCTOR(6, "博士");
    
    private final Integer code;
    private final String desc;
    
    public static Integer getCodeByDesc(String desc) {
        for (DegreeEnum value : values()) {
            if (value.desc.equals(desc)) {
                return value.code;
            }
        }
        return null;
    }
}